package com.ruoyi.common.core.domain.dto;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * Description:
 * Author: YangShiWei
 * Email: strongwalter2014@gmail.com
 * Datetime: 2023/4/16 17:29
 */
@Getter
public class CycleConfig {

    private final Integer cycleYear1;
    private final Integer cycleYear2;
    private final Integer cycleYear3;
    private final Map<Integer, Integer> configMap = new HashMap<>();

    public CycleConfig(Integer cycleYear1, Integer cycleYear2, Integer cycleYear3) {
        this.cycleYear1 = cycleYear1;
        this.cycleYear2 = cycleYear2;
        this.cycleYear3 = cycleYear3;
        configMap.put(1, cycleYear1);
        configMap.put(2, cycleYear2);
        configMap.put(3, cycleYear3);
    }

    public Integer getCycleOfYear(Integer year) {
        return configMap.get(year);
    }

    /**
     * 计算总共多少次
     *
     * @return
     */
    public Integer getCycleTotal() {
        return 12 / cycleYear1 + 12 / cycleYear2 + 12 / cycleYear3;
    }


}
